package histogram

import (
	"image"
	"image/color"
)

// Iterates over pixels and creates a histogram
func ScanImages(img image.Image, histData []int) {
	for width := img.Bounds().Min.X; width < img.Bounds().Max.X; width++ {
		for height := img.Bounds().Min.Y; height < img.Bounds().Max.Y; height++ {
			histData[img.At(width, height).(color.Gray).Y]++
		}
	}
}

// Merges the pixels in order to optimize the usage of a random function
func MergeValues(hisData []int) {
	for i := 1; i < len(hisData); i++ {
		hisData[i] += hisData[i-1]
	}
}

